<template>
	<view>
		<view>
			<!-- 加载网页url -->
			<!-- <web-view :src="contentData"></web-view> -->
			<!-- 解析html字符串用该方法 -->
			<p v-html="contentData"></p>
		</view>
	</view>
</template>

<script>
	import ajax from '@/api/api.js'
	import url from '@/api/url.js'
	export default {
		data() {
			return {
				name: '',
				contentData: '',
				id: "",

			}
		},
		onLoad(option) {
			console.log(option)
			this.id = option.id

			this.getData()


		},
		methods: {
			getData() {
				this.$londing()
				ajax(url.appAgreement, {
					data: {
						id: this.id,
					}
				}).then(res => {
					console.log(res)
					if (res.data.code === 1) {
						this.name = res.data.data.name
						this.contentData = res.data.data.content
						//修改导航标题
						uni.setNavigationBarTitle({
							title: this.name
						})
					}
				}).catch(err => {
					console.error(err)
					uni.showToast({
						title: '服务器故障,请稍后再试',
						icon: 'none'
					})
				})

			}

		}
	}
</script>

<style>

</style>